﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Collections.Generic;
using System.Web;
namespace WebSiteFool.Models
{
    [Table("Picture")]
    public class Picture
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public Guid Id { get; set; }
        public string Name { get; set; }
        [MaxLength(1024 * 1024)]
        public Byte[] Image { get; set; }
        public string ContentType { get; set; }
        public DateTime CreatedDate { get; set; }
        public virtual Article Article { get; set; }
    }

    public class PictureFile
    {
        [Required]
        [FileValidation(ErrorMessage = "Image must be smaller than 1MB, only jpg, png, bmp, gif supported")]
        public HttpPostedFileBase File { get; set; }
        [Required]
        public string Name { get; set; }
    }
}